var t = getApp();

Page({
    data: {
        language: "",
        list: [],
        optype: 1,
        merchant_center: "",
        merchant_people: "",
        merchant_reward: "",
        merchant_title: ""
    },
    onLoad: function(t) {
        t.type && (this.data.optype = t.type), this.getData(), this.initLang();
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var e = this, n = "";
        1 == this.data.optype ? n = t.getNetAddresss("plugin.merchant.frontend.staff-supplier-list") : 2 == this.data.optype && (n = t.getNetAddresss("plugin.merchant.frontend.center-supplier-list")), 
        t._getNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 === n.result ? e.setData({
                    list: n.data
                }) : wx.showToast({
                    title: n.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    initLang: function() {
        var t = wx.getStorageSync("mailLanguage");
        if (t) {
            var e = JSON.parse(t);
            this.setData({
                merchant_center: e.merchant.merchant_center || "招商中心",
                merchant_people: e.merchant.merchant_people || "招商员",
                merchant_reward: e.merchant.merchant_reward || "分红",
                merchant_title: e.merchant.title || "招商"
            });
        }
    },
    goToSupplierInfo: function(t) {
        var e = t.currentTarget.dataset.item.id || t.target.dataset.item.id;
        wx.navigateTo({
            url: "/packageB/member/enterprise/enterprise_supplier_info/enterprise_supplier_info?id=" + e
        });
    }
});